package com.hanamaki.oop.demo13.diyException;

public class Test {

    public static void main(String[] args) {

        try {
            test(101);
        } catch (MyException e) {
            System.out.println(e.toString());
        }


    }

    public static void test(int age) throws MyException {
        System.out.println("传递的参数：" + age);
        if (age < 1 || age > 100) {
            throw new MyException(age);
        } else {
            System.out.println("OK");
        }
    }
}
